package net.ib.mtalk.network.task;

import android.content.Context;
import android.os.Handler;
import net.ib.mntalk.protocol.Common.UUIDMsg;
import net.ib.mntalk.protocol.Common.UUIDSlicePredicate;
import net.ib.mntalk.protocol.Common.UUIDSliceRange;
import net.ib.mntalk.protocol.Session.GetBlockUsersReq;
import net.ib.mtalk.network.MethodId.Session;
import net.ib.mtalk.network.TcpEnvelope;
import net.ib.mtalk.util.GpbSupport;
import net.ib.mtalk.util.NotifyingAsyncQueryHandler;

public class GetBlockUsersTask extends AsyncNetTask {
	
	private Context mContext;
	private Handler mUiHandler;
	private NotifyingAsyncQueryHandler mDbHandler;

	public GetBlockUsersTask(Context _context, Handler _uiHandler) {
		super(_context, _uiHandler);
		mContext = _context;
		mUiHandler = _uiHandler;
	}

	@Override
	protected TcpEnvelope onPreExecute() {
		GetBlockUsersReq getBlockUsersReq = new GetBlockUsersReq();
		
		UUIDSlicePredicate slicePredicate = new UUIDSlicePredicate();
		int index = 0;
		slicePredicate.setId(index, GpbSupport.makeUuidMsg(333, 444));
		UUIDSliceRange range = new UUIDSliceRange();
		range.setAscending(true);
		range.setMaxCount(0);	// TODO 전부다받아오기
		slicePredicate.setSliceRange(range);
		getBlockUsersReq.setPredicate(slicePredicate);
		
		
		TcpEnvelope rev = new TcpEnvelope.Builder()
			.setType(TcpEnvelope.REQUEST)
			.setMessage(getBlockUsersReq)
			.setMethodId(Session.Block.GetBlockUsers)
			.build();
		return rev;
	}

	@Override
	protected void onPostExecute(int resultCode, Object requestObj,
			Object resultObj) {
		// TODO Auto-generated method stub

	}

}
